// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {

        createRoomBtn: cc.Button,
        joinRoomBtn: cc.Button,
        roomIdEdixBox: cc.EditBox,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start() {

    },

    onCreateRoomBtnClick() {
        console.log("onCreateRoomBtnClick called")
        cc.director.loadScene("roomScene");
    },

    onJoinRoomBtnClick() {
        console.log("onJoinRoomBtnClick called")
        let roomId = this.roomIdEdixBox.string
        if ("" == roomId || "" == roomId.trim()) {
            this.roomIdEdixBox.string = ""
            return
        }
        console.log("roomId:" + roomId)
        cc.director.loadScene("roomScene");
    },

    // update (dt) {},
});
